<?php
include('rootlogin.php');
//include('../incsession.php');
session_start();
$level=3;
if($_POST['submit']=="next"){
	$i=1;
	$number=$_POST['VC'];
	while($i <= $number)
	{	
		if($_POST['vocab'.$i]!='' && $_POST['vocab'.$i]!=' '){
			
			
			$query = "SELECT vocab FROM video WHERE topicid=".$_SESSION['topicid']." AND level=".$level;
			$result = mysql_query($query,$user_con);
	
			$row = mysql_fetch_array($result);
			$name=$row['vocab'];
			$path="../vocab/".$name;
			$file=fopen($path, "a");
			$content=$_POST['vocab'.$i]."\r\n";
			fwrite($file, $content);
			}
		$i++;
	}
	header("location: multiple_choice3.php");	
}
if(!isset($_POST['VC'])){
			$VC=1;
}
else {
			$VC=$_POST['VC'];
			$VC++;
}/*
else{
	
}*/
?>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="framestyle.css" type="text/css" media="screen">
<style type="text/css">

</style>
</head>


<body>
<div id="wrapper">
<div id="title">Online Listening Comprehension Program</div>

<div id="main">
<hr/>
<div id="title2">FOR DIFFICULT LEVEL: VOCABULARY</div>
<hr/>
<br><br>
<form method = POST action="vocab3.php" >
<table>
<?php
$i=1;
while($i<=$VC){

	echo "<tr><td align='right'>".$i.". ";
	echo '<td><input class="area medium" type="text" name="vocab'.$i.'" value="'.$_POST["vocab".$i].'">';	
	$i++;
	
}

echo "</table><input type='hidden' name='VC' value=".$VC.">";

?>


<div class="btn_right"><input type="submit" name = "submit" value = "add"></div><br>
<div class="btn_right"><input type="submit" name = "submit" value = "next"></div>
</form>
</div>
</div>
</body>

